import request from '@/utils/request'

// 查询单元管理列表
export function listUnit(query) {
  return request({
    url: '/house/unit/list',
    method: 'get',
    params: query
  })
}

// 查询单元管理详细
export function getUnit(unitId) {
  return request({
    url: '/house/unit/' + unitId,
    method: 'get'
  })
}
// 获取小区信息
export function getAreaInfo1(areaName) {
  return request({
    url: '/house/area/list2/'+areaName,
    method: 'get'
  })
}


// 新增单元管理
export function addUnit(data) {
  return request({
    url: '/house/unit',
    method: 'post',
    data: data
  })
}

// 修改单元管理
export function updateUnit(data) {
  return request({
    url: '/house/unit',
    method: 'put',
    data: data
  })
}

// 删除单元管理
export function delUnit(unitId) {
  return request({
    url: '/house/unit/' + unitId,
    method: 'delete'
  })
}

// 获取小区信息
export function getAreaInfo() {
  return request({
    url: '/house/area/list1',
    method: 'get'
  })
}

// 获取楼宇信息
export function getGroupInfo(areaName) {
  return request({
    url: '/house/group/getGroupInfo/'+areaName,
    method: 'get'
  })
}

export function moveUnit(data) {
  return request({
    url: '/house/unit/moveUnit',
    method: 'put',
    data: data
  })
}

// 获取单元信息
export function getUnitInfo(areaName,groupName) {
  return request({
    url: '/house/unit/getUnitInfo/'+areaName+"/"+groupName,
    method: 'get'
  })
}

